import request from '@/config/axios'

export interface CategoryVO {
  id: number
  name: string
  parentId: number
  score: number
  code: string
  status: number
}

// 查询分类（精简)列表
export const getSimpleCategoryList = async () => {
  return await request.get({ url: '/infra/category/list-all-simple' })
}
export const getSimpleCategoryTree = async (params) => {
  return await request.get({ url: '/infra/category/list-tree-simple', params })
}
// 查询学生课程分页
export const getCategoryPage = async (params) => {
  return await request.get({ url: `/infra/category/page`, params })
}
// 查询学生课程分页
export const getCategoryList = async (params) => {
  return await request.get({ url: `/infra/category/list`, params })
}

// 查询学生课程详情
export const getCategory = async (id: number) => {
  return await request.get({ url: `/infra/category/get?id=` + id })
}

// 新增学生课程
export const createCategory = async (data: CategoryVO) => {
  return await request.post({ url: `/infra/category/create`, data })
}

// 修改学生课程
export const updateCategory = async (data: CategoryVO) => {
  return await request.put({ url: `/infra/category/update`, data })
}

// 删除学生课程
export const deleteCategory = async (id: number) => {
  return await request.delete({ url: `/infra/category/delete?id=` + id })
}

// 导出学生课程 Excel
export const exportCategory = async (params) => {
  return await request.download({ url: `/infra/category/export-excel`, params })
}
